//
//  KVObject+PrintIvar.swift
//  KVEmoticon
//
//  Created by 李康卫 on 16/7/31.
//  Copyright © 2016年 李康卫. All rights reserved.
//

import Foundation

extension NSObject {
    //运行时获取属性
    class func printIvars() {
        var outConut: UInt32 = 0
        let ivars = class_copyIvarList(self, &outConut)
        for i in 0..<outConut {
            
            let ivar = ivars[Int(i)]
            
            let nameIvar = ivar_getName(ivar)
            
            let nameString = String(CString: nameIvar, encoding: NSUTF8StringEncoding)
            
            print(nameString)
        }
    }
}